package com.zj.study.utils.validation.validator.integeric;


import com.zj.study.utils.validation.annotation.ValidateSupport;
import com.zj.study.utils.validation.annotation.constraint.Int;
import org.springframework.lang.NonNull;

/**
 * @author 谭耀飞
 * @since 2021.06.0
 */
@ValidateSupport(String.class)
public class IntValidatorForString extends AbstractIntValidator<String> {

  @Override
  boolean compare(@NonNull Int anInt, @NonNull String value) {
    for(char c: value.toCharArray()) {
      if (!Character.isDigit(c)) {
        return false;
      }
    }
    return true;
  }

}
